﻿class Node extends MovieClip {
	public var lines:Array = new Array;
	
	public function init(px:Number, py:Number):Void {
		lines = [];
		_x = px;
		_y = py;
	}
	
	public function addLine(l:Line):Void {
		lines.push(l);
	}
	
	public function update():Void {
		for(var l in lines) {
			lines[l].update();
		}
	}
	
	/*
	* DRAGGING NODES
	* If you click + drag a node, you can alter the line(s) it belongs to,
	* changing the positions and angles of surfaces
	*/
	public function onPress():Void {
		startDrag(this);
		
		this.onEnterFrame = function() {
			update();
		}
	};
	
	public function onRelease() {
		stopDrag();
		delete this.onEnterFrame ();
	};
}